home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 February / EnigmA AMIGA RUN 34 (1999)(G.R. Edizioni)(IT)[!][issue 1999-02].iso / earcd / devel / libx11 / include / x11 / extensions / xinput.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  24KB  |  825 lines

  1. /* $Header: XInput.h,v 1.14 91/07/24 15:33:51 rws Exp $ */
  2.  
  3. /************************************************************
  4. Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California, and the 
  5. Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.             All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its
  10. documentation for any purpose and without fee is hereby granted,
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in
  13. supporting documentation, and that the names of Hewlett-Packard or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.
  16.  
  17. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ********************************************************/
  26.  
  27. /* Definitions used by the library and client */
  28.  
  29. #ifndef _XINPUT_H_
  30. #define _XINPUT_H_
  31.  
  32. #ifndef _XLIB_H_
  33. #include <X11/Xlib.h>
  34. #endif
  35.  
  36. #ifndef _XI_H_
  37. #include "XI.h"
  38. #endif
  39.  
  40. #define _deviceKeyPress        0
  41. #define _deviceKeyRelease    1
  42.  
  43. #define _deviceButtonPress    0
  44. #define _deviceButtonRelease    1
  45.  
  46. #define _deviceMotionNotify    0
  47.  
  48. #define _deviceFocusIn        0
  49. #define _deviceFocusOut        1
  50.  
  51. #define _proximityIn        0
  52. #define _proximityOut        1
  53.  
  54. #define _deviceStateNotify    0
  55. #define _deviceMappingNotify    1
  56. #define _changeDeviceNotify    2
  57.  
  58. #define FindTypeAndClass(d,type,_class,classid,offset) \
  59.     { int i; XInputClassInfo *ip; \
  60.     type = 0; _class = 0; \
  61.     for (i=0, ip= ((XDevice *) d)->classes; \
  62.      i< ((XDevice *) d)->num_classes; \
  63.      i++, ip++) \
  64.     if (ip->input_class == classid) \
  65.         {type =  ip->event_type_base + offset; \
  66.          _class =  ((XDevice *) d)->device_id << 8 | type;}}
  67.  
  68. #define DeviceKeyPress(d,type,_class) \
  69.     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
  70.  
  71. #define DeviceKeyRelease(d,type,_class) \
  72.     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
  73.  
  74. #define DeviceButtonPress(d,type,_class) \
  75.     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
  76.  
  77. #define DeviceButtonRelease(d,type,_class) \
  78.     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
  79.  
  80. #define DeviceMotionNotify(d,type,_class) \
  81.     FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
  82.  
  83. #define DeviceFocusIn(d,type,_class) \
  84.     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
  85.  
  86. #define DeviceFocusOut(d,type,_class) \
  87.     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
  88.  
  89. #define ProximityIn(d,type,_class) \
  90.     FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
  91.  
  92. #define ProximityOut(d,type,_class) \
  93.     FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
  94.  
  95. #define DeviceStateNotify(d,type,_class) \
  96.     FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
  97.  
  98. #define DeviceMappingNotify(d,type,_class) \
  99.     FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
  100.  
  101. #define ChangeDeviceNotify(d,type,_class) \
  102.     FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
  103.  
  104. #define DevicePointerMotionHint(d,type,_class) \
  105.     { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
  106.  
  107. #define DeviceButton1Motion(d,type,_class) \
  108.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
  109.  
  110. #define DeviceButton2Motion(d,type,_class) \
  111.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
  112.  
  113. #define DeviceButton3Motion(d,type,_class) \
  114.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
  115.  
  116. #define DeviceButton4Motion(d,type,class) \
  117.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
  118.  
  119. #define DeviceButton5Motion(d,type,_class) \
  120.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
  121.  
  122. #define DeviceButtonMotion(d,type,class) \
  123.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
  124.  
  125. #define DeviceOwnerGrabButton(d,type,_class) \
  126.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
  127.  
  128. #define DeviceButtonPressGrab(d,type,_class) \
  129.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
  130.  
  131. #define NoExtensionEvent(d,type,_class) \
  132.     { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
  133.  
  134. #define BadDevice(dpy,error) _xibaddevice(dpy, &error)
  135.  
  136. #define BadClass(dpy,error) _xibadclass(dpy, &error)
  137.  
  138. #define BadEvent(dpy,error) _xibadevent(dpy, &error)
  139.  
  140. #define BadMode(dpy,error) _xibadmode(dpy, &error)
  141.  
  142. #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
  143.  
  144. /***************************************************************
  145.  *
  146.  * DeviceKey events.  These events are sent by input devices that
  147.  * support input class Keys.
  148.  * The location of the X pointer is reported in the coordinate
  149.  * fields of the x,y and x_root,y_root fields.
  150.  *
  151.  */
  152.  
  153. typedef struct 
  154.     {
  155.     int            type;         /* of event */
  156.     unsigned long  serial;       /* # of last request processed */
  157.     Bool           send_event;   /* true if from SendEvent request */
  158.     Display        *display;     /* Display the event was read from */
  159.     Window         window;       /* "event" window reported relative to */
  160.     XID            deviceid;
  161.     Window         root;         /* root window event occured on */
  162.     Window         subwindow;    /* child window */
  163.     Time           time;         /* milliseconds */
  164.     int            x, y;         /* x, y coordinates in event window */
  165.     int            x_root;       /* coordinates relative to root */
  166.     int            y_root;       /* coordinates relative to root */
  167.     unsigned int   state;        /* key or button mask */
  168.     unsigned int   keycode;      /* detail */
  169.     Bool           same_screen;  /* same screen flag */
  170.     unsigned int   device_state; /* device key or button mask */
  171.     unsigned char  axes_count;
  172.     unsigned char  first_axis;
  173.     int            axis_data[6];
  174.     } XDeviceKeyEvent;
  175.  
  176. typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
  177. typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
  178.  
  179. /*******************************************************************
  180.  *
  181.  * DeviceButton events.  These events are sent by extension devices
  182.  * that support input class Buttons.
  183.  *
  184.  */
  185.  
  186. typedef struct {
  187.     int           type;         /* of event */
  188.     unsigned long serial;       /* # of last request processed by server */
  189.     Bool          send_event;   /* true if from a SendEvent request */
  190.     Display       *display;     /* Display the event was read from */
  191.     Window        window;       /* "event" window reported relative to */
  192.     XID           deviceid;
  193.     Window        root;         /* root window that the event occured on */
  194.     Window        subwindow;    /* child window */
  195.     Time          time;         /* milliseconds */
  196.     int           x, y;         /* x, y coordinates in event window */
  197.     int           x_root;       /* coordinates relative to root */
  198.     int           y_root;       /* coordinates relative to root */
  199.     unsigned int  state;        /* key or button mask */
  200.     unsigned int  button;       /* detail */
  201.     Bool          same_screen;  /* same screen flag */
  202.     unsigned int  device_state; /* device key or button mask */
  203.     unsigned char axes_count;
  204.     unsigned char first_axis;
  205.     int           axis_data[6];
  206.     } XDeviceButtonEvent;
  207.  
  208. typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
  209. typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
  210.  
  211. /*******************************************************************
  212.  *
  213.  * DeviceMotionNotify event.  These events are sent by extension devices
  214.  * that support input class Valuators.
  215.  *
  216.  */
  217.  
  218. typedef struct 
  219.     {
  220.     int           type;        /* of event */
  221.     unsigned long serial;      /* # of last request processed by server */
  222.     Bool          send_event;  /* true if from a SendEvent request */
  223.     Display       *display;    /* Display the event was read from */
  224.     Window        window;      /* "event" window reported relative to */
  225.     XID           deviceid;
  226.     Window        root;        /* root window that the event occured on */
  227.     Window        subwindow;   /* child window */
  228.     Time          time;        /* milliseconds */
  229.     int           x, y;        /* x, y coordinates in event window */
  230.     int           x_root;      /* coordinates relative to root */
  231.     int           y_root;      /* coordinates relative to root */
  232.     unsigned int  state;       /* key or button mask */
  233.     char          is_hint;     /* detail */
  234.     Bool          same_screen; /* same screen flag */
  235.     unsigned int  device_state; /* device key or button mask */
  236.     unsigned char axes_count;
  237.     unsigned char first_axis;
  238.     int           axis_data[6];
  239.     } XDeviceMotionEvent;
  240.  
  241. /*******************************************************************
  242.  *
  243.  * DeviceFocusChange events.  These events are sent when the focus
  244.  * of an extension device that can be focused is changed.
  245.  *
  246.  */
  247.  
  248. typedef struct 
  249.     {
  250.     int           type;       /* of event */
  251.     unsigned long serial;     /* # of last request processed by server */
  252.     Bool          send_event; /* true if from a SendEvent request */
  253.     Display       *display;   /* Display the event was read from */
  254.     Window        window;     /* "event" window reported relative to */
  255.     XID           deviceid;
  256.     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
  257.     int           detail;
  258.     /*
  259.      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
  260.      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
  261.      * NotifyPointerRoot, NotifyDetailNone 
  262.      */
  263.     Time                time;
  264.     } XDeviceFocusChangeEvent;
  265.  
  266. typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
  267. typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
  268.  
  269. /*******************************************************************
  270.  *
  271.  * ProximityNotify events.  These events are sent by those absolute
  272.  * positioning devices that are capable of generating proximity information.
  273.  *
  274.  */
  275.  
  276. typedef struct 
  277.     {
  278.     int             type;      /* ProximityIn or ProximityOut */        
  279.     unsigned long   serial;    /* # of last request processed by server */
  280.     Bool            send_event; /* true if this came from a SendEvent request */
  281.     Display         *display;  /* Display the event was read from */
  282.     Window          window;      
  283.     XID                deviceid;
  284.     Window          root;            
  285.     Window          subwindow;      
  286.     Time            time;            
  287.     int             x, y;            
  288.     int             x_root, y_root;  
  289.     unsigned int    state;           
  290.     Bool            same_screen;     
  291.     unsigned int    device_state; /* device key or button mask */
  292.     unsigned char   axes_count;
  293.     unsigned char   first_axis;
  294.     int             axis_data[6];
  295.     } XProximityNotifyEvent;
  296. typedef XProximityNotifyEvent XProximityInEvent;
  297. typedef XProximityNotifyEvent XProximityOutEvent;
  298.  
  299. /*******************************************************************
  300.  *
  301.  * DeviceStateNotify events are generated on EnterWindow and FocusIn 
  302.  * for those clients who have selected DeviceState.
  303.  *
  304.  */
  305.  
  306. typedef struct
  307.     {
  308. #if defined(__cplusplus) || defined(c_plusplus)
  309.     unsigned char    c_class;
  310. #else
  311.     unsigned char    class;
  312. #endif
  313.     unsigned char    length;
  314.     } XInputClass;
  315.  
  316. typedef struct {
  317.     int           type;
  318.     unsigned long serial;       /* # of last request processed by server */
  319.     Bool          send_event;   /* true if this came from a SendEvent request */
  320.     Display       *display;     /* Display the event was read from */
  321.     Window        window;
  322.     XID           deviceid;
  323.     Time          time;
  324.     int           num_classes;
  325.     char      data[64];
  326. } XDeviceStateNotifyEvent;    
  327.  
  328. typedef struct {
  329. #if defined(__cplusplus) || defined(c_plusplus)
  330.     unsigned char    c_class;
  331. #else
  332.     unsigned char    class;
  333. #endif
  334.     unsigned char    length;
  335.     unsigned char    num_valuators;
  336.     unsigned char    mode;
  337.     int                valuators[6];
  338. } XValuatorStatus;
  339.  
  340. typedef struct {
  341. #if defined(__cplusplus) || defined(c_plusplus)
  342.     unsigned char    c_class;
  343. #else
  344.     unsigned char    class;
  345. #endif
  346.     unsigned char    length;
  347.     short        num_keys;
  348.     char            keys[32];
  349. } XKeyStatus;
  350.  
  351. typedef struct {
  352. #if defined(__cplusplus) || defined(c_plusplus)
  353.     unsigned char    c_class;
  354. #else
  355.     unsigned char    class;
  356. #endif
  357.     unsigned char    length;
  358.     short        num_buttons;
  359.     char            buttons[32];
  360. } XButtonStatus;
  361.  
  362. /*******************************************************************
  363.  *
  364.  * DeviceMappingNotify event.  This event is sent when the key mapping,
  365.  * modifier mapping, or button mapping of an extension device is changed.
  366.  *
  367.  */
  368.  
  369. typedef struct {
  370.     int           type;
  371.     unsigned long serial;       /* # of last request processed by server */
  372.     Bool          send_event;   /* true if this came from a SendEvent request */
  373.     Display       *display;     /* Display the event was read from */
  374.     Window        window;       /* unused */
  375.     XID           deviceid;
  376.     Time          time;
  377.     int           request;      /* one of MappingModifier, MappingKeyboard,
  378.                                     MappingPointer */
  379.     int           first_keycode;/* first keycode */
  380.     int           count;        /* defines range of change w. first_keycode*/
  381. } XDeviceMappingEvent;
  382.  
  383. /*******************************************************************
  384.  *
  385.  * ChangeDeviceNotify event.  This event is sent when an 
  386.  * XChangeKeyboard or XChangePointer request is made.
  387.  *
  388.  */
  389.  
  390. typedef struct {
  391.     int           type;
  392.     unsigned long serial;       /* # of last request processed by server */
  393.     Bool          send_event;   /* true if this came from a SendEvent request */
  394.     Display       *display;     /* Display the event was read from */
  395.     Window        window;       /* unused */
  396.     XID           deviceid;
  397.     Time          time;
  398.     int           request;      /* NewPointer or NewKeyboard */
  399. } XChangeDeviceNotifyEvent;
  400.  
  401. /*******************************************************************
  402.  *
  403.  * Control structures for input devices that support input class
  404.  * Feedback.  These are used by the XGetFeedbackControl and 
  405.  * XChangeFeedbackControl functions.
  406.  *
  407.  */
  408.  
  409. typedef struct {
  410. #if defined(__cplusplus) || defined(c_plusplus)
  411.      XID            c_class;
  412. #else
  413.      XID            class;
  414. #endif
  415.      int            length;
  416.      XID            id;
  417. } XFeedbackState;
  418.  
  419. typedef struct {
  420. #if defined(__cplusplus) || defined(c_plusplus)
  421.     XID     c_class;
  422. #else
  423.     XID     class;
  424. #endif
  425.     int     length;
  426.     XID     id;
  427.     int     click;
  428.     int     percent;
  429.     int     pitch;
  430.     int     duration;
  431.     int     led_mask;
  432.     int     global_auto_repeat;
  433.     char    auto_repeats[32];
  434. } XKbdFeedbackState;
  435.  
  436. typedef struct {
  437. #if defined(__cplusplus) || defined(c_plusplus)
  438.     XID     c_class;
  439. #else
  440.     XID     class;
  441. #endif
  442.     int     length;
  443.     XID     id;
  444.     int     accelNum;
  445.     int     accelDenom;
  446.     int     threshold;
  447. } XPtrFeedbackState;
  448.  
  449. typedef struct {
  450. #if defined(__cplusplus) || defined(c_plusplus)
  451.     XID     c_class;
  452. #else
  453.     XID     class;
  454. #endif
  455.     int     length;
  456.     XID     id;
  457.     int     resolution;
  458.     int     minVal;
  459.     int     maxVal;
  460. } XIntegerFeedbackState;
  461.  
  462. typedef struct {
  463. #if defined(__cplusplus) || defined(c_plusplus)
  464.     XID     c_class;
  465. #else
  466.     XID     class;
  467. #endif
  468.     int     length;
  469.     XID     id;
  470.     int     max_symbols;
  471.     int     num_syms_supported;
  472.     KeySym  *syms_supported;
  473. } XStringFeedbackState;
  474.  
  475. typedef struct {
  476. #if defined(__cplusplus) || defined(c_plusplus)
  477.     XID     c_class;
  478. #else
  479.     XID     class;
  480. #endif
  481.     int     length;
  482.     XID     id;
  483.     int     percent;
  484.     int     pitch;
  485.     int     duration;
  486. } XBellFeedbackState;
  487.  
  488. typedef struct {
  489. #if defined(__cplusplus) || defined(c_plusplus)
  490.     XID     c_class;
  491. #else
  492.     XID     class;
  493. #endif
  494.     int     length;
  495.     XID     id;
  496.     int     led_values;
  497.     int     led_mask;
  498. } XLedFeedbackState;
  499.  
  500. typedef struct {
  501. #if defined(__cplusplus) || defined(c_plusplus)
  502.      XID            c_class;
  503. #else
  504.      XID            class;
  505. #endif
  506.      int            length;
  507.      XID        id;
  508. } XFeedbackControl;
  509.  
  510. typedef struct {
  511. #if defined(__cplusplus) || defined(c_plusplus)
  512.     XID     c_class;
  513. #else
  514.     XID     class;
  515. #endif
  516.     int     length;
  517.     XID     id;
  518.     int     accelNum;
  519.     int     accelDenom;
  520.     int     threshold;
  521. } XPtrFeedbackControl;
  522.  
  523. typedef struct {
  524. #if defined(__cplusplus) || defined(c_plusplus)
  525.     XID     c_class;
  526. #else
  527.     XID     class;
  528. #endif
  529.     int     length;
  530.     XID     id;
  531.     int     click;
  532.     int     percent;
  533.     int     pitch;
  534.     int     duration;
  535.     int     led_mask;
  536.     int     led_value;
  537.     int     key;
  538.     int     auto_repeat_mode;
  539. } XKbdFeedbackControl;
  540.  
  541. typedef struct {
  542. #if defined(__cplusplus) || defined(c_plusplus)
  543.     XID     c_class;
  544. #else
  545.     XID     class;
  546. #endif
  547.     int     length;
  548.     XID     id;
  549.     int     num_keysyms;
  550.     KeySym  *syms_to_display;
  551. } XStringFeedbackControl;
  552.  
  553. typedef struct {
  554. #if defined(__cplusplus) || defined(c_plusplus)
  555.     XID     c_class;
  556. #else
  557.     XID     class;
  558. #endif
  559.     int     length;
  560.     XID     id;
  561.     int     int_to_display;
  562. } XIntegerFeedbackControl;
  563.  
  564. typedef struct {
  565. #if defined(__cplusplus) || defined(c_plusplus)
  566.     XID     c_class;
  567. #else
  568.     XID     class;
  569. #endif
  570.     int     length;
  571.     XID     id;
  572.     int     percent;
  573.     int     pitch;
  574.     int     duration;
  575. } XBellFeedbackControl;
  576.  
  577. typedef struct {
  578. #if defined(__cplusplus) || defined(c_plusplus)
  579.     XID     c_class;
  580. #else
  581.     XID     class;
  582. #endif
  583.     int     length;
  584.     XID     id;
  585.     int     led_mask;
  586.     int     led_values;
  587. } XLedFeedbackControl;
  588.  
  589. /*******************************************************************
  590.  *
  591.  * Device control structures.
  592.  *
  593.  */
  594.  
  595. typedef struct {
  596.      XID            control;
  597.      int            length;
  598. } XDeviceControl;
  599.  
  600. typedef struct {
  601.      XID            control;
  602.      int            length;
  603.      int            first_valuator;
  604.      int            num_valuators;
  605.      int            *resolutions;
  606. } XDeviceResolutionControl;
  607.  
  608. typedef struct {
  609.      XID            control;
  610.      int            length;
  611.      int            num_valuators;
  612.      int            *resolutions;
  613.      int            *min_resolutions;
  614.      int            *max_resolutions;
  615. } XDeviceResolutionState;
  616.  
  617. /*******************************************************************
  618.  *
  619.  * An array of XDeviceList structures is returned by the 
  620.  * XListInputDevices function.  Each entry contains information
  621.  * about one input device.  Among that information is an array of 
  622.  * pointers to structures that describe the characteristics of 
  623.  * the input device.
  624.  *
  625.  */
  626.  
  627. typedef struct _XAnyClassinfo *XAnyClassPtr;
  628.  
  629. typedef struct _XAnyClassinfo {
  630. #if defined(__cplusplus) || defined(c_plusplus)
  631.     XID     c_class;
  632. #else
  633.     XID     class;
  634. #endif
  635.     int     length;
  636.     } XAnyClassInfo;
  637.  
  638. typedef struct _XDeviceInfo *XDeviceInfoPtr;
  639.  
  640. typedef struct _XDeviceInfo
  641.     {
  642.     XID                 id;        
  643.     Atom                type;
  644.     char                *name;
  645.     int                 num_classes;
  646.     int                 use;
  647.     XAnyClassPtr     inputclassinfo;
  648.     } XDeviceInfo;
  649.  
  650. typedef struct _XKeyInfo *XKeyInfoPtr;
  651.  
  652. typedef struct _XKeyInfo
  653.     {
  654. #if defined(__cplusplus) || defined(c_plusplus)
  655.     XID            c_class;
  656. #else
  657.     XID            class;
  658. #endif
  659.     int            length;
  660.     unsigned short      min_keycode;
  661.     unsigned short      max_keycode;
  662.     unsigned short      num_keys;
  663.     } XKeyInfo;
  664.  
  665. typedef struct _XButtonInfo *XButtonInfoPtr;
  666.  
  667. typedef struct _XButtonInfo {
  668. #if defined(__cplusplus) || defined(c_plusplus)
  669.     XID        c_class;
  670. #else
  671.     XID        class;
  672. #endif
  673.     int        length;
  674.     short     num_buttons;
  675.     } XButtonInfo;
  676.  
  677. typedef struct _XAxisInfo *XAxisInfoPtr;
  678.  
  679. typedef struct _XAxisInfo {
  680.     int     resolution;
  681.     int     min_value;
  682.     int     max_value;
  683.     } XAxisInfo;
  684.  
  685. typedef struct _XValuatorInfo *XValuatorInfoPtr;
  686.  
  687. typedef struct    _XValuatorInfo
  688.     {
  689. #if defined(__cplusplus) || defined(c_plusplus)
  690.     XID            c_class;
  691. #else
  692.     XID            class;
  693. #endif
  694.     int            length;
  695.     unsigned char       num_axes;
  696.     unsigned char       mode;
  697.     unsigned long       motion_buffer;
  698.     XAxisInfoPtr        axes;
  699.     } XValuatorInfo;
  700.  
  701.  
  702. /*******************************************************************
  703.  *
  704.  * An XDevice structure is returned by the XOpenDevice function.  
  705.  * It contains an array of pointers to XInputClassInfo structures.
  706.  * Each contains information about a class of input supported by the
  707.  * device, including a pointer to an array of data for each type of event
  708.  * the device reports.
  709.  *
  710.  */
  711.  
  712.  
  713. typedef struct {
  714.         unsigned char   input_class;
  715.         unsigned char   event_type_base;
  716. } XInputClassInfo;
  717.  
  718. typedef struct {
  719.         XID                    device_id;
  720.         int                    num_classes;
  721.         XInputClassInfo        *classes;
  722. } XDevice;
  723.  
  724.  
  725. /*******************************************************************
  726.  *
  727.  * The following structure is used to return information for the 
  728.  * XGetSelectedExtensionEvents function.
  729.  *
  730.  */
  731.  
  732. typedef struct {
  733.         XEventClass     event_type;
  734.         XID             device;
  735. } XEventList;
  736.  
  737. /*******************************************************************
  738.  *
  739.  * The following structure is used to return motion history data from 
  740.  * an input device that supports the input class Valuators.
  741.  * This information is returned by the XGetDeviceMotionEvents function.
  742.  *
  743.  */
  744.  
  745. typedef struct {
  746.         Time   time;
  747.         int    *data;
  748. } XDeviceTimeCoord;
  749.  
  750.  
  751. /*******************************************************************
  752.  *
  753.  * Device state structure.
  754.  * This is returned by the XQueryDeviceState request.
  755.  *
  756.  */
  757.  
  758. typedef struct {
  759.         XID        device_id;
  760.         int        num_classes;
  761.         XInputClass    *data;
  762. } XDeviceState;
  763.  
  764. /*******************************************************************
  765.  *
  766.  * Note that the mode field is a bitfield that reports the Proximity
  767.  * status of the device as well as the mode.  The mode field should
  768.  * be OR'd with the mask DeviceMode and compared with the values
  769.  * Absolute and Relative to determine the mode, and should be OR'd
  770.  * with the mask ProximityState and compared with the values InProximity
  771.  * and OutOfProximity to determine the proximity state.
  772.  *
  773.  */
  774.  
  775. typedef struct {
  776. #if defined(__cplusplus) || defined(c_plusplus)
  777.     unsigned char    c_class;
  778. #else
  779.     unsigned char    class;
  780. #endif
  781.     unsigned char    length;
  782.     unsigned char    num_valuators;
  783.     unsigned char    mode;
  784.     int                *valuators;
  785. } XValuatorState;
  786.  
  787. typedef struct {
  788. #if defined(__cplusplus) || defined(c_plusplus)
  789.     unsigned char    c_class;
  790. #else
  791.     unsigned char    class;
  792. #endif
  793.     unsigned char    length;
  794.     short        num_keys;
  795.     char            keys[32];
  796. } XKeyState;
  797.  
  798. typedef struct {
  799. #if defined(__cplusplus) || defined(c_plusplus)
  800.     unsigned char    c_class;
  801. #else
  802.     unsigned char    class;
  803. #endif
  804.     unsigned char    length;
  805.     short        num_buttons;
  806.     char            buttons[32];
  807. } XButtonState;
  808.  
  809. /*******************************************************************
  810.  *
  811.  * Function definitions.
  812.  *
  813.  */
  814.  
  815. XDevice                *XOpenDevice();
  816. XDeviceInfo            *XListInputDevices();
  817. XDeviceTimeCoord       *XGetDeviceMotionEvents();
  818. KeySym                 *XGetDeviceKeyMapping();
  819. XModifierKeymap        *XGetDeviceModifierMapping();
  820. XFeedbackState         *XGetFeedbackControl();
  821. XExtensionVersion      *XGetExtensionVersion();
  822. XDeviceState           *XQueryDeviceState();
  823. XEventClass            *XGetDeviceDontPropagateList();
  824. #endif /* _XINPUT_H_ */
  825.